<?php
header("Content-type:application/json;charset:utf-8");
date_default_timezone_set('PRC');
define('ROOT',dirname(__FILE__));
session_start();
if (isset($_SESSION['user'])) {
	if (!empty($_REQUEST['content'])) {
		$txt = $_REQUEST['content'];
		$txt = date("Y-m-d H:i:s",time()).'    '.$txt.PHP_EOL;
		file_put_contents('text.txt',$txt,FILE_APPEND);
	}
	$content = file('text.txt');
	// print_r($content);die;
	/*if (strlen($content)==0 && isset($content)) {
		$content = "还没有人留言哟";
	}*/
	if (empty($content)) {
		$content = ["还没有人留言哟"];
	}
	exit(json_encode($content));
}else{
	exit(json_encode(['nologin']));
}









